home *** CD-ROM | disk | FTP | other *** search
/ Game Programming in C++ - Start to Finish / GameProgrammingS.iso / developer_install / CEGUISDK-0.4.1-VC6-Native.exe / {app} / include / falagard / CEGUIFalFrameComponent.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-07-23  |  6.0 KB  |  166 lines

  1. /************************************************************************
  2.     filename:   CEGUIFalFrameComponent.h
  3.     created:    Mon Jul 18 2005
  4.     author:     Paul D Turner <paul@cegui.org.uk>
  5. *************************************************************************/
  6. /*************************************************************************
  7.     Crazy Eddie's GUI System (http://www.cegui.org.uk)
  8.     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
  9.  
  10.     This library is free software; you can redistribute it and/or
  11.     modify it under the terms of the GNU Lesser General Public
  12.     License as published by the Free Software Foundation; either
  13.     version 2.1 of the License, or (at your option) any later version.
  14.  
  15.     This library is distributed in the hope that it will be useful,
  16.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  18.     Lesser General Public License for more details.
  19.  
  20.     You should have received a copy of the GNU Lesser General Public
  21.     License along with this library; if not, write to the Free Software
  22.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  23. *************************************************************************/
  24. #ifndef _CEGUIFalFrameComponent_h_
  25. #define _CEGUIFalFrameComponent_h_
  26.  
  27. #include "falagard/CEGUIFalComponentBase.h"
  28.  
  29. // Start of CEGUI namespace section
  30. namespace CEGUI
  31. {
  32.     /*!
  33.     \brief
  34.         Class that encapsulates information for a frame with background (9 images in total)
  35.  
  36.         Corner images are always drawn at their natural size, edges are stretched between the corner
  37.         pieces for a particular edge, the background image will cover the inner rectangle formed by
  38.         the edge images and can be stretched or tiled in either dimension.
  39.     */
  40.     class CEGUIEXPORT FrameComponent : public FalagardComponentBase
  41.     {
  42.     public:
  43.         /*!
  44.         \brief
  45.             Constructor
  46.         */
  47.         FrameComponent();
  48.  
  49.         /*!
  50.         \brief
  51.             Return the current vertical formatting setting for this FrameComponent.
  52.  
  53.         \return
  54.             One of the VerticalFormatting enumerated values.
  55.         */
  56.         VerticalFormatting getBackgroundVerticalFormatting() const;
  57.  
  58.         /*!
  59.         \brief
  60.             Set the vertical formatting setting for this FrameComponent.
  61.  
  62.         \param fmt
  63.             One of the VerticalFormatting enumerated values.
  64.  
  65.         \return
  66.             Nothing.
  67.         */
  68.         void setBackgroundVerticalFormatting(VerticalFormatting fmt);
  69.  
  70.         /*!
  71.         \brief
  72.             Return the current horizontal formatting setting for this FrameComponent.
  73.  
  74.         \return
  75.             One of the HorizontalFormatting enumerated values.
  76.         */
  77.         HorizontalFormatting getBackgroundHorizontalFormatting() const;
  78.  
  79.         /*!
  80.         \brief
  81.             Set the horizontal formatting setting for this FrameComponent.
  82.  
  83.         \param fmt
  84.             One of the HorizontalFormatting enumerated values.
  85.  
  86.         \return
  87.             Nothing.
  88.         */
  89.         void setBackgroundHorizontalFormatting(HorizontalFormatting fmt);
  90.  
  91.         /*!
  92.         \brief
  93.             Return the Image object that will be drawn by this FrameComponent for a specified frame part.
  94.  
  95.         \param part
  96.             One of the FrameImageComponent enumerated values specifying the component image to be accessed.
  97.  
  98.         \return
  99.             Image object.
  100.         */
  101.         const Image* getImage(FrameImageComponent part) const;
  102.  
  103.         /*!
  104.         \brief
  105.             Set the Image that will be drawn by this ImageryComponent.
  106.  
  107.         \param part
  108.             One of the FrameImageComponent enumerated values specifying the component image to be accessed.
  109.  
  110.         \param image
  111.             Pointer to the Image object to be drawn by this FrameComponent.
  112.  
  113.         \return
  114.             Nothing.
  115.         */
  116.         void setImage(FrameImageComponent part, const Image* image);
  117.  
  118.         /*!
  119.         \brief
  120.             Set the Image that will be drawn by this FrameComponent.
  121.  
  122.         \param part
  123.             One of the FrameImageComponent enumerated values specifying the component image to be accessed.
  124.  
  125.         \param imageset
  126.             String holding the name of the Imagset that contains the Image to be rendered.
  127.  
  128.         \param image
  129.             String holding the name of the Image to be rendered.
  130.  
  131.         \return
  132.             Nothing.
  133.         */
  134.         void setImage(FrameImageComponent part, const String& imageset, const String& image);
  135.  
  136.         /*!
  137.         \brief
  138.             Writes an xml representation of this FrameComponent to \a out_stream.
  139.  
  140.         \param out_stream
  141.             Stream where xml data should be output.
  142.  
  143.         \return
  144.             Nothing.
  145.         */
  146.         void writeXMLToStream(OutStream& out_stream) const;
  147.  
  148.     protected:
  149.         // implemets abstract from base
  150.         void render_impl(Window& srcWindow, Rect& destRect, float base_z, const CEGUI::ColourRect* modColours, const Rect* clipper, bool clipToDisplay) const;
  151.  
  152.         // renders the background image (basically a clone of render_impl from ImageryComponent - maybe we need a helper class?)
  153.         void doBackgroundRender(Window& srcWindow, Rect& destRect, float base_z, const ColourRect& colours, const Rect* clipper, bool clipToDisplay) const;
  154.  
  155.         // formatting options for background
  156.         VerticalFormatting   d_vertFormatting;  //!< Vertical formatting to be applied when rendering the background for the component.
  157.         HorizontalFormatting d_horzFormatting;  //!< Horizontal formatting to be applied when rendering the background for the component.
  158.         // images for the frame
  159.         const Image* d_frameImages[FIC_FRAME_IMAGE_COUNT];  //!< Array that holds the assigned images.
  160.     };
  161.  
  162. } // End of  CEGUI namespace section
  163.  
  164.  
  165. #endif  // end of guard _CEGUIFalFrameComponent_h_
  166.